import "../css/index.css"; // 没有使用css-loader的时候,打包的时候会报错
import "../css/component.less";
function component() {
    const element = document.createElement("div");
    element.innerHTML = ["hello", "webpack"].join("-");
    element.className = "content";
    //创建一个img元素
    const imgEl = new Image();
    imgEl.src = require("../img/img1.jpg").default; // webpack5中返回的是一个module对象,需要通过default的方式进行访问
    element.appendChild(imgEl);

    // 创建一个div,设置背景图
    const bgDivEl = document.createElement("div");
    bgDivEl.style.height = "200px";
    bgDivEl.style.width = "200px";
    bgDivEl.className = "bg-image";
    bgDivEl.style.backgroundColor = "red";
    element.appendChild(bgDivEl);

    const bgDivEl2 = document.createElement("div");
    bgDivEl2.style.height = "200px";
    bgDivEl2.style.width = "200px";
    bgDivEl2.className = "bg-image2";
    bgDivEl2.style.backgroundColor = "red";
    element.appendChild(bgDivEl2);

    const iEl = document.createElement("i");
    iEl.className = "icontfont why_icon icon-ashbin";
    element.appendChild(iEl);

    return element;
}
document.body.appendChild(component());
